<template>
  <view class="order-card-component">
    <view class="order-card">
      <view class="order-status-title">
        <view class="order-status-image">
          <image v-if="orderInfo.orderStatusIcon" class="icon-status" :src="orderInfo.orderStatusIcon"></image>
          <text class="status-text">{{ orderInfo.orderStatusName || '状态未知' }}</text>
        </view>
        <view
          v-if="showDeliverModule"
          class="order-status-deliver"
          @click="$emit('deliver')"
        >
          <text>{{ orderInfo.code ? '我要更改物流单号' : '手动关联快递单号' }}</text>
          <image class="icon-more" src="https://s1.huishoubao.com/static/web/recycle/icon_orders_more.png"></image>
        </view>
      </view>
      <view class="order-status-desc">{{ orderInfo.orderStatusDesc || '暂无详细信息' }}</view>
    </view>
  </view>
</template>

<script>
import { orderStatusMap } from '@/config'

export default {
	props: {
		orderInfo: Object
	},
	computed: {
		showDeliverModule () {
			return Boolean(orderStatusMap.deliverMap[this.orderInfo.orderStatusNo])
		},
	}
}
</script>

<style lang="scss" scoped>
@import './index.scss';
</style>
